package itheimacase;

import java.text.ParseException;
import java.util.Date;

public class DateDemo {
    public static void main(String[] args) throws ParseException {
        //创建日期对象
        Date d = new Date();
        String s1 = DateUtils.dateToString(d, "yyyy年MM月dd日 HH:mm:ss");
        System.out.println(s1);
        System.out.println("-------------");
        String s2 = "2022-01-29 12:2:3";
        Date date = DateUtils.stringToDate(s2, "yyyy-MM-dd HH:mm:ss");
        System.out.println(date);
    }
}
